// 商品详情api
import request from '@/utils/request'

// 登录
export const userAccountLogin = ({ account, password }) => {
  return request('/login', 'post', { account, password })
}

// 发送验证码
export const userMobileLoginMsg = (mobile) => {
  return request('/login/code', 'get', { mobile })
}

// 短信登录
export const userMobileLogin = ({ mobile, code }) => {
  return request('/login/code', 'post', { mobile, code })
}

// qq登录
export const userQQLogin = (unionId, source = 1) => {
  return request('/login/social', 'post', { unionId, source })
}

// QQ绑定发送验证码
export const userQQBindCode = (mobile) => {
  return request('/login/social/code', 'get', { mobile })
}

// qq登录绑定账号
export const userQQBindLogin = ({ unionId, mobile, code }) => {
  return request('/login/social/bind', 'post', { unionId, mobile, code })
}

// 校验帐号是否存在
export const userCheckAccount = (account) => {
  return request('/register/check', 'get', { account })
}

// 获取qq完善信息验证码
export const userQQPatchCode = (mobile) => {
  return request('/register/code', 'get', { mobile })
}

// 完善信息
export const userQQPatchLogin = ({ unionId, mobile, code, account, password }) => {
  return request(`/login/social/${unionId}/complement`, 'post', { mobile, code, account, password })
}

// 解绑信息
export const userQQUnbind = (mobile) => {
  return request('/login/social/unbind', 'get', { mobile })
}
